﻿CREATE PROCEDURE [ServiceEngine].[ListBindingsForBindingElementID]
	@BindingElementID uniqueidentifier
AS
BEGIN
	SET NOCOUNT ON;

	SELECT	N.[EntityID] as BindingID, N.[EntityName] as [Name], N.EntityDescription as Description
	FROM	[ServiceEngine].Names N
	WHERE	N.[EntityTypeID] = 6
		AND EXISTS (SELECT 1 FROM [ServiceEngine].Bindings_BindingElements BBE 
			WHERE BBE.BindingElementID = @BindingElementID AND N.EntityID = BBE.BindingID)
	Order by N.[EntityName]
	
END
